﻿using System.Collections.Generic;
using System.Linq;
using EstimateTracker.DataAccess.Repositories;
using EstimateTracker.Domain.Entities;
using NUnit.Framework;

namespace EstimateTracker.DataAccess.Tests.Repositories.Integration
{
    [TestFixture]
    public class ProjectRepositoryTest
    {
        [Test]
        public void FindAll_WithPopulatedDatabase_FindsAllProjectsInDatabase()
        {
            // Arrange

            // Act
            var projectRepository = new ProjectRepository(new PersistenceManager());
            IEnumerable<Project> projects = projectRepository.FindAll().ToList();
            
            // Assert
            Assert.That(projects,Is.Not.Null);
            Assert.That(projects.Any());
            Assert.That(projects.First().Activities,Is.Not.Null);
            Assert.That(projects.First().Activities.Any());
            Assert.That(projects.First().Activities.First(),Is.Not.Null);
        } 
    }
}